<!doctype html>
<html lang="ru" data-bs-theme="dark">

<head>
    <!-- 2024-05-11 11:46:46 -->
        <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Git - gitformat chunk</title>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css" integrity="sha512-jnSuA4Ss2PkkikSOLtYs8BlYIeeIK1h99ty4YfvRPAlzr377vr3CXDb7sb7eEEBYjDtcYj+AjBH3FLv5uSJuXg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" integrity="sha512-dPXYcDub/aeb08c63jRq/k6GaKccl256JQy/AnOq7CAnEZ9FzSL9wSbcZkMp4R26vBsMLFYH4kQ67/bbV8XaCQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" integrity="sha512-rO+olRTkcf304DQBxSWxln8JXCzTHlKnIdnMUwYvQa9/Jd4cQaNkItIUj6Z4nvW1dqK0SKXLbn9h4KwZTNtAyw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/7.1.0/css/flag-icons.min.css" integrity="sha512-bZBu2H0+FGFz/stDN/L0k8J0G8qVsAL0ht1qg5kTwtAheiXwiRKyCq1frwfbSFSJN3jooR5kauE0YjtPzhZtJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link href="../../../runebook.css" rel="stylesheet" type="text/css">
    <meta name="x-github" content="https://github.com/runebookdev/runebook">
            <meta name="x-i18n-doc" content="git">
        <script>
        function i18n(element) {
            // NOP
        }
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/3.0.5/js.cookie.js" integrity="sha512-F/dia2jKME12jwqiYDayeD+Rr/8jTWUD2wfbuJB0bzSwenSEnXsn4qQ/wVyXUCix5bmCAj8xJdtFr2OqUtjLAw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js" integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/7.8.1/rxjs.umd.min.js" integrity="sha512-D9LDs8YUUVa4V9Gl4Zb+xqRAc7RCzooR3+zzebgK2RMu/KU+dh90pbjEEMzPiSyRSGbSp9j1pZnrO4joGa5WEg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha512-mhbv5DqBMgrWL+32MmsDOt/OAvqr/cHimk6B8y/bx/xS88MVkYGPiVv2ixKVrkywF2qHplNRUvFsAHUdxZ3Krg==" crossorigin="anonymous"></script>
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6424571640879890" crossorigin="anonymous"></script>    <script async src="https://www.googletagmanager.com/gtag/js?id=G-3G5BZ1QEDP"></script>
<script>
    window.dataLayer = window.dataLayer || [];

    function gtag() {
        dataLayer.push(arguments);
    }

    gtag('js', new Date());
    gtag('config', 'G-3G5BZ1QEDP');
</script>    <script>
(function(c, l, a, r, i, t, y) {
    c[a] = c[a] || function() {
        (c[a].q = c[a].q || []).push(arguments)
    };
    t = l.createElement(r);
    t.async = 1;
    t.src = "https://www.clarity.ms/tag/" + i + "?ref=bwt";
    y = l.getElementsByTagName(r)[0];
    y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "jto2hd94r9");
</script>    <script src="../../../theme.js"></script>
</head>

<body>
    <header class="bg-black">
        <div class="container">
            <div class="row">
                <div class="col">
                    <nav class="navbar navbar-expand-lg navbar-dark">
                        <a class="navbar-brand fw-bold" href="https://runebook.dev/ru">
                            <img alt="Runebook.dev" class="d-inline-block align-top mr-1" src="../../../assets/runebook_logo.webp" width="24" height="24">
                            Runebook.dev
                        </a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                            <span class="navbar-toggler-icon"></span>
                        </button>
                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                                <li class="nav-item">
                                    <a class="nav-link" href="https://runebook.dev/ru#docs">Documentation</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://runebook.dev/contributors">Contributors</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://github.com/runebookdev/runebook/issues">GitHub</a>
                                </li>
                            </ul>
                                                                                                <button class="btn btn-success ms-2" id="showPopupButton">
                                        <i class="bi bi-translate"></i>
                                        Show English
                                    </button>
                                                                                        <div class="form-check form-switch ms-3">
                                <label class="text-light">
                                    <input class="form-check-input" type="checkbox" role="switch" id="theme-switch" checked>
                                    <i class="bi bi-moon-stars-fill"></i>
                                </label>
                            </div>
                        </div>
                    </nav>
                </div>
            </div>
        </div>
    </header>

    <!--sse-->
    <div class="container">
    <div class="row">
        <div class="col">
            <nav aria-label="breadcrumb" class="mt-2">
                <ol class="breadcrumb mb-1">
                    <li class="breadcrumb-item">
                        <a href="https://runebook.dev/ru#docs">
                            <span class="fi fi-ru"></span>                            Русский                        </a>
                    </li>
                    <li class="breadcrumb-item">
                        <a href="-index-.html">
                            Git                            2.43                        </a>
                    </li>
                                            <li class="breadcrumb-item">
                            <a href="-index-.html#Miscellaneous">
                                Miscellaneous                            </a>
                        </li>
                                    </ol>
            </nav>
        </div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-9">
            <main>
                <article>

                    
                    <h1 class="text-body-emphasis" ><span data-i18n="b364bbe8e023442b523ef9e7de398328093f5fa0426864ea5dad3b218025d65a/5c" data-source="gitformat-chunk" onmousemove="i18n(this)">gitformat-chunk</span></h1> <h2 class="text-body-emphasis"  id="_name"><span data-i18n="dcd1d5223f73b3a965c07e3ff5dbee3eedcfedb806686a05b9b3868a2c3d6d50/3a" data-source="Name" onmousemove="i18n(this)">Name</span></h2> <div> <p><span data-i18n="cb5cc58bc859215f0740062dd6b08926cef60804a4ab84edbe2ebf726e56dcfb/1e" data-source="gitformat-chunk - Chunk-based file formats" onmousemove="i18n(this)">gitformat-chunk &mdash; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ycy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;</span></p> </div> <h2 class="text-body-emphasis"  id="_synopsis"><span data-i18n="8eb3755381519d7f0479d75446e56e20084834c0460d7ec94926932372ea6c47/0d" data-source="Synopsis" onmousemove="i18n(this)">Synopsis</span></h2> <div> <p><span data-i18n="27bbe2b100c6bc24ba0081dedd71d97d8cb648d627cc6c688e055790cf92e90d/64" data-source="Used by &lt;a href=&quot;gitformat-commit-graph&quot;&gt;gitformat-commit-graph[5]&lt;/a&gt; and the &amp;quot;MIDX&amp;quot; format (see the pack format documentation in &lt;a href=&quot;gitformat-pack&quot;&gt;gitformat-pack[5]&lt;/a&gt;)." onmousemove="i18n(this)">&Icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ocy;&mcy;  <a href="gitformat-commit-graph.html">gitformat-commit-graph[5]</a>  &icy;  &quot;MIDX&quot;  (&scy;&mcy;. &dcy;&ocy;&kcy;&ucy;&mcy;&iecy;&ncy;&tcy;&acy;&tscy;&icy;&yucy; &pcy;&ocy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ucy; &pcy;&acy;&kcy;&iecy;&tcy;&acy; &vcy;  <a href="gitformat-pack.html">gitformat-pack[5]</a> ).</span></p> </div> <h2 class="text-body-emphasis"  id="_description"><span data-i18n="526e0087cc3f254d9f86f6c7d8e23d954c4dfda2b312efc29194ae8a860106ba/d3" data-source="Description" onmousemove="i18n(this)">Description</span></h2> <div> <p><span data-i18n="31681ba13573eed6ddc475ea836d5ec44dd687784b31e058449a8846f55b538f/9d" data-source="Some file formats in Git use a common concept of &amp;quot;chunks&amp;quot; to describe sections of the file. This allows structured access to a large file by scanning a small &amp;quot;table of contents&amp;quot; for the remaining data. This common format is used by the &lt;code&gt;commit-graph&lt;/code&gt; and &lt;code&gt;multi-pack-index&lt;/code&gt; files. See the &lt;code&gt;multi-pack-index&lt;/code&gt; format in &lt;a href=&quot;gitformat-pack&quot;&gt;gitformat-pack[5]&lt;/a&gt; and the &lt;code&gt;commit-graph&lt;/code&gt; format in &lt;a href=&quot;gitformat-commit-graph&quot;&gt;gitformat-commit-graph[5]&lt;/a&gt; for how they use the chunks to describe structured data." onmousemove="i18n(this)">&Ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ycy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &vcy;  Git  &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yucy;&tcy; &ocy;&bcy;&shchcy;&ucy;&yucy; &kcy;&ocy;&ncy;&tscy;&iecy;&pcy;&tscy;&icy;&yucy;  &quot;chunks&quot;  &dcy;&lcy;&yacy; &ocy;&pcy;&icy;&scy;&acy;&ncy;&icy;&yacy; &rcy;&acy;&zcy;&dcy;&iecy;&lcy;&ocy;&vcy; &fcy;&acy;&jcy;&lcy;&acy;. &Ecy;&tcy;&ocy; &ocy;&bcy;&iecy;&scy;&pcy;&iecy;&chcy;&icy;&vcy;&acy;&iecy;&tcy; &scy;&tcy;&rcy;&ucy;&kcy;&tcy;&ucy;&rcy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ycy;&jcy; &dcy;&ocy;&scy;&tcy;&ucy;&pcy; &kcy; &bcy;&ocy;&lcy;&softcy;&shcy;&ocy;&mcy;&ucy; &fcy;&acy;&jcy;&lcy;&ucy; &pcy;&ucy;&tcy;&iecy;&mcy; &scy;&kcy;&acy;&ncy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&icy;&yacy; &ncy;&iecy;&bcy;&ocy;&lcy;&softcy;&shcy;&ocy;&gcy;&ocy;  &quot;table of contents&quot;  &ncy;&acy; &ncy;&acy;&lcy;&icy;&chcy;&icy;&iecy; &ocy;&scy;&tcy;&acy;&vcy;&shcy;&icy;&khcy;&scy;&yacy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy;. &Ecy;&tcy;&ocy;&tcy; &ocy;&bcy;&shchcy;&icy;&jcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &fcy;&acy;&jcy;&lcy;&acy;&mcy;&icy;  <code>commit-graph</code>  &icy;  <code>multi-pack-index</code> . &Scy;&mcy;. &fcy;&ocy;&rcy;&mcy;&acy;&tcy;  <code>multi-pack-index</code>  &vcy;  <a href="gitformat-pack.html">gitformat-pack[5]</a>  &icy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;  <code>commit-graph</code>  &vcy;  <a href="gitformat-commit-graph.html">gitformat-commit-graph[5]</a> , &chcy;&tcy;&ocy;&bcy;&ycy; &ucy;&zcy;&ncy;&acy;&tcy;&softcy;, &kcy;&acy;&kcy; &ocy;&ncy;&icy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yucy;&tcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ycy; &dcy;&lcy;&yacy; &ocy;&pcy;&icy;&scy;&acy;&ncy;&icy;&yacy; &scy;&tcy;&rcy;&ucy;&kcy;&tcy;&ucy;&rcy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ycy;&khcy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy;.</span></p> <p><span data-i18n="8325e669cbd088d2c23b096b0accce16caf22063030c26025659a384039e6b52/d5" data-source="A chunk-based file format begins with some header information custom to that format. That header should include enough information to identify the file type, format version, and number of chunks in the file. From this information, that file can determine the start of the chunk-based region." onmousemove="i18n(this)">&Fcy;&ocy;&rcy;&mcy;&acy;&tcy; &fcy;&acy;&jcy;&lcy;&acy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &ncy;&acy;&chcy;&icy;&ncy;&acy;&iecy;&tcy;&scy;&yacy; &scy; &ncy;&iecy;&kcy;&ocy;&tcy;&ocy;&rcy;&ocy;&jcy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&icy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&kcy;&acy;, &acy;&dcy;&acy;&pcy;&tcy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ocy;&jcy; &kcy; &ecy;&tcy;&ocy;&mcy;&ucy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ucy;. &Ecy;&tcy;&ocy;&tcy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&ocy;&kcy; &dcy;&ocy;&lcy;&zhcy;&iecy;&ncy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&acy;&tcy;&softcy; &dcy;&ocy;&scy;&tcy;&acy;&tcy;&ocy;&chcy;&ncy;&ocy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&icy; &dcy;&lcy;&yacy; &icy;&dcy;&iecy;&ncy;&tcy;&icy;&fcy;&icy;&kcy;&acy;&tscy;&icy;&icy; &tcy;&icy;&pcy;&acy; &fcy;&acy;&jcy;&lcy;&acy;, &vcy;&iecy;&rcy;&scy;&icy;&icy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &icy; &kcy;&ocy;&lcy;&icy;&chcy;&iecy;&scy;&tcy;&vcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &vcy; &fcy;&acy;&jcy;&lcy;&iecy;. &Ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &ecy;&tcy;&ocy;&jcy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&icy; &ecy;&tcy;&ocy;&tcy; &fcy;&acy;&jcy;&lcy; &mcy;&ocy;&zhcy;&iecy;&tcy; &ocy;&pcy;&rcy;&iecy;&dcy;&iecy;&lcy;&icy;&tcy;&softcy; &ncy;&acy;&chcy;&acy;&lcy;&ocy; &ocy;&bcy;&lcy;&acy;&scy;&tcy;&icy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;.</span></p> <p><span data-i18n="7417aca652c051446c82e1913a876122968b02839311e1133ec03262d9ea54da/5b" data-source="The chunk-based region starts with a table of contents describing where each chunk starts and ends. This consists of (C+1) rows of 12 bytes each, where C is the number of chunks. Consider the following table:" onmousemove="i18n(this)">&Ocy;&bcy;&lcy;&acy;&scy;&tcy;&softcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &ncy;&acy;&chcy;&icy;&ncy;&acy;&iecy;&tcy;&scy;&yacy; &scy; &ocy;&gcy;&lcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&yacy;, &ocy;&pcy;&icy;&scy;&ycy;&vcy;&acy;&yucy;&shchcy;&iecy;&gcy;&ocy;, &gcy;&dcy;&iecy; &ncy;&acy;&chcy;&icy;&ncy;&acy;&iecy;&tcy;&scy;&yacy; &icy; &zcy;&acy;&kcy;&acy;&ncy;&chcy;&icy;&vcy;&acy;&iecy;&tcy;&scy;&yacy; &kcy;&acy;&zhcy;&dcy;&ycy;&jcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;. &Ocy;&ncy; &scy;&ocy;&scy;&tcy;&ocy;&icy;&tcy; &icy;&zcy; (C+1) &scy;&tcy;&rcy;&ocy;&kcy; &pcy;&ocy; 12 &bcy;&acy;&jcy;&tcy; &kcy;&acy;&zhcy;&dcy;&acy;&yacy;, &gcy;&dcy;&iecy; C &mdash; &kcy;&ocy;&lcy;&icy;&chcy;&iecy;&scy;&tcy;&vcy;&ocy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;. &Rcy;&acy;&scy;&scy;&mcy;&ocy;&tcy;&rcy;&icy;&mcy; &scy;&lcy;&iecy;&dcy;&ucy;&yucy;&shchcy;&ucy;&yucy; &tcy;&acy;&bcy;&lcy;&icy;&tscy;&ucy;:</span></p> <div> <div> <pre class="hljs language-less">| <span class="hljs-selector-tag">Chunk</span> <span class="hljs-selector-tag">ID</span> (<span class="hljs-number">4</span> bytes) | <span class="hljs-selector-tag">Chunk</span> <span class="hljs-selector-tag">Offset</span> (<span class="hljs-number">8</span> bytes) |
|<span class="hljs-selector-tag">--------------------</span>|<span class="hljs-selector-tag">------------------------</span>|
| <span class="hljs-selector-tag">ID</span><span class="hljs-selector-attr">[0]</span>              | <span class="hljs-selector-tag">OFFSET</span><span class="hljs-selector-attr">[0]</span>              |
| ...                | ...                    |
| <span class="hljs-selector-tag">ID</span><span class="hljs-selector-attr">[C]</span>              | <span class="hljs-selector-tag">OFFSET</span><span class="hljs-selector-attr">[C]</span>              |
| <span class="hljs-number">0</span><span class="hljs-selector-tag">x0000</span>             | <span class="hljs-selector-tag">OFFSET</span><span class="hljs-selector-attr">[C+1]</span>            |</pre> </div> </div> <p><span data-i18n="d541fff0def749cf9d8164266b9c4db3c6081ed7ea3f5e3786bb9182584c0628/90" data-source="Each row consists of a 4-byte chunk identifier (ID) and an 8-byte offset. Each integer is stored in network-byte order." onmousemove="i18n(this)">&Kcy;&acy;&zhcy;&dcy;&acy;&yacy; &scy;&tcy;&rcy;&ocy;&kcy;&acy; &scy;&ocy;&scy;&tcy;&ocy;&icy;&tcy; &icy;&zcy; 4-&bcy;&acy;&jcy;&tcy;&ocy;&vcy;&ocy;&gcy;&ocy; &icy;&dcy;&iecy;&ncy;&tcy;&icy;&fcy;&icy;&kcy;&acy;&tcy;&ocy;&rcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy; (ID) &icy; 8-&bcy;&acy;&jcy;&tcy;&ocy;&vcy;&ocy;&gcy;&ocy; &scy;&mcy;&iecy;&shchcy;&iecy;&ncy;&icy;&yacy;. &Kcy;&acy;&zhcy;&dcy;&ocy;&iecy; &tscy;&iecy;&lcy;&ocy;&iecy; &chcy;&icy;&scy;&lcy;&ocy; &khcy;&rcy;&acy;&ncy;&icy;&tcy;&scy;&yacy; &vcy; &scy;&iecy;&tcy;&iecy;&vcy;&ocy;&mcy; &pcy;&ocy;&rcy;&yacy;&dcy;&kcy;&iecy; &bcy;&acy;&jcy;&tcy;&ocy;&vcy;.</span></p> <p><span data-i18n="8322d45f178c79120bf4d851d32701166001c676c993076aaf7cf5f39b5164c4/b6" data-source="The chunk identifier &lt;code&gt;ID[i]&lt;/code&gt; is a label for the data stored within this file from &lt;code&gt;OFFSET[i]&lt;/code&gt; (inclusive) to &lt;code&gt;OFFSET[i+1]&lt;/code&gt; (exclusive). Thus, the size of the &lt;code&gt;i`th chunk is equal to the difference between `OFFSET[i+1]&lt;/code&gt; and &lt;code&gt;OFFSET[i]&lt;/code&gt;. This requires that the chunk data appears contiguously in the same order as the table of contents." onmousemove="i18n(this)">&Icy;&dcy;&iecy;&ncy;&tcy;&icy;&fcy;&icy;&kcy;&acy;&tcy;&ocy;&rcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;  <code>ID[i]</code>  &mdash; &ecy;&tcy;&ocy; &mcy;&iecy;&tcy;&kcy;&acy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy;, &khcy;&rcy;&acy;&ncy;&yacy;&shchcy;&icy;&khcy;&scy;&yacy; &vcy; &ecy;&tcy;&ocy;&mcy; &fcy;&acy;&jcy;&lcy;&iecy;, &ocy;&tcy;  <code>OFFSET[i]</code>  (&vcy;&kcy;&lcy;&yucy;&chcy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ocy;) &dcy;&ocy;  <code>OFFSET[i+1]</code>  (&ecy;&kcy;&scy;&kcy;&lcy;&yucy;&zcy;&icy;&vcy;&ncy;&ocy;). &Tcy;&acy;&kcy;&icy;&mcy; &ocy;&bcy;&rcy;&acy;&zcy;&ocy;&mcy;, &rcy;&acy;&zcy;&mcy;&iecy;&rcy;&ycy;  <code>i`th chunk is equal to the difference between `OFFSET[i+1]</code>  &icy;  <code>OFFSET[i]</code>  . &Dcy;&lcy;&yacy; &ecy;&tcy;&ocy;&gcy;&ocy; &ncy;&iecy;&ocy;&bcy;&khcy;&ocy;&dcy;&icy;&mcy;&ocy;, &chcy;&tcy;&ocy;&bcy;&ycy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &rcy;&acy;&scy;&pcy;&ocy;&lcy;&acy;&gcy;&acy;&lcy;&icy;&scy;&softcy; &ncy;&iecy;&pcy;&rcy;&iecy;&rcy;&ycy;&vcy;&ncy;&ocy; &vcy; &tcy;&ocy;&mcy; &zhcy;&iecy; &pcy;&ocy;&rcy;&yacy;&dcy;&kcy;&iecy;, &chcy;&tcy;&ocy; &icy; &tcy;&acy;&bcy;&lcy;&icy;&tscy;&acy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&acy;&ncy;&icy;&yacy;.</span></p> <p><span data-i18n="40a0942987e5e868d338c9b4d91e92c3fc8b56b8fec69e98fb1c5bb56c9d2f8f/b7" data-source="The final entry in the table of contents must be four zero bytes. This confirms that the table of contents is ending and provides the offset for the end of the chunk-based data." onmousemove="i18n(this)">&Pcy;&ocy;&scy;&lcy;&iecy;&dcy;&ncy;&yacy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&softcy; &vcy; &ocy;&gcy;&lcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&icy; &dcy;&ocy;&lcy;&zhcy;&ncy;&acy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&acy;&tcy;&softcy; &chcy;&iecy;&tcy;&ycy;&rcy;&iecy; &ncy;&ucy;&lcy;&iecy;&vcy;&ycy;&khcy; &bcy;&acy;&jcy;&tcy;&acy;. &Ecy;&tcy;&ocy; &pcy;&ocy;&dcy;&tcy;&vcy;&iecy;&rcy;&zhcy;&dcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy; &ocy;&gcy;&lcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy; &zcy;&acy;&kcy;&acy;&ncy;&chcy;&icy;&vcy;&acy;&iecy;&tcy;&scy;&yacy;, &icy; &ocy;&bcy;&iecy;&scy;&pcy;&iecy;&chcy;&icy;&vcy;&acy;&iecy;&tcy; &scy;&mcy;&iecy;&shchcy;&iecy;&ncy;&icy;&iecy; &kcy;&ocy;&ncy;&tscy;&acy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;.</span></p> <p><span data-i18n="fa11aab7a2a6b8b9808d6cce5d777039748329b0e478ddb120093af1089e1da1/e4" data-source="Note: The chunk-based format expects that the file contains &lt;code&gt;at least&lt;/code&gt; a trailing hash after &lt;code&gt;OFFSET[C+1]&lt;/code&gt;." onmousemove="i18n(this)">&Pcy;&rcy;&icy;&mcy;&iecy;&chcy;&acy;&ncy;&icy;&iecy;. &Fcy;&ocy;&rcy;&mcy;&acy;&tcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &pcy;&rcy;&iecy;&dcy;&pcy;&ocy;&lcy;&acy;&gcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy; &fcy;&acy;&jcy;&lcy; &scy;&ocy;&dcy;&iecy;&rcy;&zhcy;&icy;&tcy;  <code>at least</code>  &icy; &kcy;&ocy;&ncy;&iecy;&chcy;&ncy;&ycy;&jcy; &khcy;&ecy;&shcy; &pcy;&ocy;&scy;&lcy;&iecy;  <code>OFFSET[C+1]</code>  .</span></p> <p><span data-i18n="de9ae0400a9e0a392438dd9321d74dfd7c68240a11c3252d4fececb036e2486b/4a" data-source="Functions for working with chunk-based file formats are declared in &lt;code&gt;chunk-format.h&lt;/code&gt;. Using these methods provide extra checks that assist developers when creating new file formats." onmousemove="i18n(this)">&Fcy;&ucy;&ncy;&kcy;&tscy;&icy;&icy; &dcy;&lcy;&yacy; &rcy;&acy;&bcy;&ocy;&tcy;&ycy; &scy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy;&mcy;&icy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &ocy;&bcy;&hardcy;&yacy;&vcy;&lcy;&iecy;&ncy;&ycy; &vcy;  <code>chunk-format.h</code> . &Icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&ncy;&icy;&iecy; &ecy;&tcy;&icy;&khcy; &mcy;&iecy;&tcy;&ocy;&dcy;&ocy;&vcy; &ocy;&bcy;&iecy;&scy;&pcy;&iecy;&chcy;&icy;&vcy;&acy;&iecy;&tcy; &dcy;&ocy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&iecy;&lcy;&softcy;&ncy;&ycy;&iecy; &pcy;&rcy;&ocy;&vcy;&iecy;&rcy;&kcy;&icy;, &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&iecy; &pcy;&ocy;&mcy;&ocy;&gcy;&acy;&yucy;&tcy; &rcy;&acy;&zcy;&rcy;&acy;&bcy;&ocy;&tcy;&chcy;&icy;&kcy;&acy;&mcy; &pcy;&rcy;&icy; &scy;&ocy;&zcy;&dcy;&acy;&ncy;&icy;&icy; &ncy;&ocy;&vcy;&ycy;&khcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ocy;&vcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy;.</span></p> </div> <h2 class="text-body-emphasis"  id="_writing_chunk_based_file_formats"><span data-i18n="a9f4a21d77c5323e6a71c8579e4daff6192abe63ab7cce3b47c99ef8e6b1507d/9c" data-source="Writing chunk-based file formats" onmousemove="i18n(this)">&Ncy;&acy;&pcy;&icy;&scy;&acy;&ncy;&icy;&iecy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ocy;&vcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;</span></h2> <div> <p><span data-i18n="4f380e17ced5a08e94c9da45a6fbb5c7536ff2496719bba9e332bdcad5f88075/7a" data-source="To write a chunk-based file format, create a &lt;code&gt;struct chunkfile&lt;/code&gt; by calling &lt;code&gt;init_chunkfile()&lt;/code&gt; and pass a &lt;code&gt;struct hashfile&lt;/code&gt; pointer. The caller is responsible for opening the &lt;code&gt;hashfile&lt;/code&gt; and writing header information so the file format is identifiable before the chunk-based format begins." onmousemove="i18n(this)">&CHcy;&tcy;&ocy;&bcy;&ycy; &zcy;&acy;&pcy;&icy;&scy;&acy;&tcy;&softcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy; &fcy;&acy;&jcy;&lcy;&acy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;, &scy;&ocy;&zcy;&dcy;&acy;&jcy;&tcy;&iecy;  <code>struct chunkfile</code> , &vcy;&ycy;&zcy;&vcy;&acy;&vcy;  <code>init_chunkfile()</code>  &icy; &pcy;&iecy;&rcy;&iecy;&dcy;&acy;&vcy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&softcy;  <code>struct hashfile</code> . &Vcy;&ycy;&zcy;&ycy;&vcy;&acy;&yucy;&shchcy;&acy;&yacy; &scy;&tcy;&ocy;&rcy;&ocy;&ncy;&acy; &ocy;&tcy;&vcy;&iecy;&chcy;&acy;&iecy;&tcy; &zcy;&acy; &ocy;&tcy;&kcy;&rcy;&ycy;&tcy;&icy;&iecy;  <code>hashfile</code>  &icy; &zcy;&acy;&pcy;&icy;&scy;&softcy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&icy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&kcy;&acy;, &chcy;&tcy;&ocy;&bcy;&ycy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy; &fcy;&acy;&jcy;&lcy;&acy; &mcy;&ocy;&zhcy;&ncy;&ocy; &bcy;&ycy;&lcy;&ocy; &icy;&dcy;&iecy;&ncy;&tcy;&icy;&fcy;&icy;&tscy;&icy;&rcy;&ocy;&vcy;&acy;&tcy;&softcy; &dcy;&ocy; &tcy;&ocy;&gcy;&ocy;, &kcy;&acy;&kcy; &ncy;&acy;&chcy;&ncy;&iecy;&tcy;&scy;&yacy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&icy;&iecy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;.</span></p> <p><span data-i18n="8eb149810a7017d1ccd4f3a56475287fab4d08771b7dcd7b35fa88818455f01e/7e" data-source="Then, call &lt;code&gt;add_chunk()&lt;/code&gt; for each chunk that is intended for writing. This populates the &lt;code&gt;chunkfile&lt;/code&gt; with information about the order and size of each chunk to write. Provide a &lt;code&gt;chunk_write_fn&lt;/code&gt; function pointer to perform the write of the chunk data upon request." onmousemove="i18n(this)">&Zcy;&acy;&tcy;&iecy;&mcy; &vcy;&ycy;&zcy;&ocy;&vcy;&icy;&tcy;&iecy;  <code>add_chunk()</code>  &dcy;&lcy;&yacy; &kcy;&acy;&zhcy;&dcy;&ocy;&gcy;&ocy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;, &pcy;&rcy;&iecy;&dcy;&ncy;&acy;&zcy;&ncy;&acy;&chcy;&iecy;&ncy;&ncy;&ocy;&gcy;&ocy; &dcy;&lcy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&icy;. &Pcy;&rcy;&icy; &ecy;&tcy;&ocy;&mcy;  <code>chunkfile</code>  &zcy;&acy;&pcy;&ocy;&lcy;&ncy;&yacy;&iecy;&tcy;&scy;&yacy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&iecy;&jcy; &ocy; &pcy;&ocy;&rcy;&yacy;&dcy;&kcy;&iecy; &icy; &rcy;&acy;&zcy;&mcy;&iecy;&rcy;&iecy; &kcy;&acy;&zhcy;&dcy;&ocy;&gcy;&ocy; &zcy;&acy;&pcy;&icy;&scy;&ycy;&vcy;&acy;&iecy;&mcy;&ocy;&gcy;&ocy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;. &Pcy;&rcy;&iecy;&dcy;&ocy;&scy;&tcy;&acy;&vcy;&softcy;&tcy;&iecy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&softcy; &fcy;&ucy;&ncy;&kcy;&tscy;&icy;&icy;  <code>chunk_write_fn</code>  &dcy;&lcy;&yacy; &vcy;&ycy;&pcy;&ocy;&lcy;&ncy;&iecy;&ncy;&icy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&icy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy; &pcy;&ocy; &zcy;&acy;&pcy;&rcy;&ocy;&scy;&ucy;.</span></p> <p><span data-i18n="33e89efff6db30c9948cd58d9e49e736aea3744ffbe60cd9f7466031888e60c7/25" data-source="Call &lt;code&gt;write_chunkfile()&lt;/code&gt; to write the table of contents to the &lt;code&gt;hashfile&lt;/code&gt; followed by each of the chunks. This will verify that each chunk wrote the expected amount of data so the table of contents is correct." onmousemove="i18n(this)">&Vcy;&ycy;&zcy;&ocy;&vcy;&icy;&tcy;&iecy;  <code>write_chunkfile()</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &zcy;&acy;&pcy;&icy;&scy;&acy;&tcy;&softcy; &ocy;&gcy;&lcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy; &vcy;  <code>hashfile</code> , &zcy;&acy; &kcy;&ocy;&tcy;&ocy;&rcy;&ycy;&mcy; &scy;&lcy;&iecy;&dcy;&ucy;&yucy;&tcy; &vcy;&scy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ycy;. &Ecy;&tcy;&ocy; &pcy;&ocy;&zcy;&vcy;&ocy;&lcy;&icy;&tcy; &ucy;&bcy;&iecy;&dcy;&icy;&tcy;&softcy;&scy;&yacy;, &chcy;&tcy;&ocy; &kcy;&acy;&zhcy;&dcy;&ycy;&jcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy; &zcy;&acy;&pcy;&icy;&scy;&acy;&lcy; &ocy;&zhcy;&icy;&dcy;&acy;&iecy;&mcy;&ycy;&jcy; &ocy;&bcy;&hardcy;&iecy;&mcy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy;, &pcy;&ocy;&ecy;&tcy;&ocy;&mcy;&ucy; &ocy;&gcy;&lcy;&acy;&vcy;&lcy;&iecy;&ncy;&icy;&iecy; &pcy;&rcy;&acy;&vcy;&icy;&lcy;&softcy;&ncy;&ocy;&iecy;.</span></p> <p><span data-i18n="7f21a117644b7bd08ea300d89b24ba81045ad6fe197b530f9aa947789c65178d/cd" data-source="Finally, call &lt;code&gt;free_chunkfile()&lt;/code&gt; to clear the &lt;code&gt;struct chunkfile&lt;/code&gt; data. The caller is responsible for finalizing the &lt;code&gt;hashfile&lt;/code&gt; by writing the trailing hash and closing the file." onmousemove="i18n(this)">&Ncy;&acy;&kcy;&ocy;&ncy;&iecy;&tscy;, &vcy;&ycy;&zcy;&ocy;&vcy;&icy;&tcy;&iecy;  <code>free_chunkfile()</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &ocy;&chcy;&icy;&scy;&tcy;&icy;&tcy;&softcy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy;  <code>struct chunkfile</code> . &Vcy;&ycy;&zcy;&ycy;&vcy;&acy;&yucy;&shchcy;&acy;&yacy; &scy;&tcy;&ocy;&rcy;&ocy;&ncy;&acy; &ocy;&tcy;&vcy;&iecy;&chcy;&acy;&iecy;&tcy; &zcy;&acy; &zcy;&acy;&vcy;&iecy;&rcy;&shcy;&iecy;&ncy;&icy;&iecy;  <code>hashfile</code>  &pcy;&ucy;&tcy;&iecy;&mcy; &zcy;&acy;&pcy;&icy;&scy;&icy; &kcy;&ocy;&ncy;&iecy;&chcy;&ncy;&ocy;&gcy;&ocy; &khcy;&iecy;&shcy;&acy; &icy; &zcy;&acy;&kcy;&rcy;&ycy;&tcy;&icy;&yacy; &fcy;&acy;&jcy;&lcy;&acy;.</span></p> </div> <h2 class="text-body-emphasis"  id="_reading_chunk_based_file_formats"><span data-i18n="229fd1cbad4aec378d0771d534b30b0a25fc4314ea31327aedb7723e42f795d0/a7" data-source="Reading chunk-based file formats" onmousemove="i18n(this)">&CHcy;&tcy;&iecy;&ncy;&icy;&iecy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ocy;&vcy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;</span></h2> <div> <p><span data-i18n="81d84328ea3014003e4b06f1a933d7ca6cc004cc8969a8bf88446e604a3407a0/47" data-source="To read a chunk-based file format, the file must be opened as a memory-mapped region. The chunk-format API expects that the entire file is mapped as a contiguous memory region." onmousemove="i18n(this)">&CHcy;&tcy;&ocy;&bcy;&ycy; &pcy;&rcy;&ocy;&chcy;&icy;&tcy;&acy;&tcy;&softcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy; &fcy;&acy;&jcy;&lcy;&acy; &ncy;&acy; &ocy;&scy;&ncy;&ocy;&vcy;&iecy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;, &fcy;&acy;&jcy;&lcy; &dcy;&ocy;&lcy;&zhcy;&iecy;&ncy; &bcy;&ycy;&tcy;&softcy; &ocy;&tcy;&kcy;&rcy;&ycy;&tcy; &kcy;&acy;&kcy; &ocy;&bcy;&lcy;&acy;&scy;&tcy;&softcy;, &ocy;&tcy;&ocy;&bcy;&rcy;&acy;&zhcy;&iecy;&ncy;&ncy;&acy;&yacy; &vcy; &pcy;&acy;&mcy;&yacy;&tcy;&icy;. API &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &ocy;&zhcy;&icy;&dcy;&acy;&iecy;&tcy;, &chcy;&tcy;&ocy; &vcy;&iecy;&scy;&softcy; &fcy;&acy;&jcy;&lcy; &ocy;&tcy;&ocy;&bcy;&rcy;&acy;&zhcy;&acy;&iecy;&tcy;&scy;&yacy; &kcy;&acy;&kcy; &ncy;&iecy;&pcy;&rcy;&iecy;&rcy;&ycy;&vcy;&ncy;&acy;&yacy; &ocy;&bcy;&lcy;&acy;&scy;&tcy;&softcy; &pcy;&acy;&mcy;&yacy;&tcy;&icy;.</span></p> <p><span data-i18n="97079d124f4e48d91ccea4dce6d09f9ffe2d3e17c35b34581eb7d1c011b65d48/af" data-source="Initialize a &lt;code&gt;struct chunkfile&lt;/code&gt; pointer with &lt;code&gt;init_chunkfile(NULL)&lt;/code&gt;." onmousemove="i18n(this)">&Icy;&ncy;&icy;&tscy;&icy;&acy;&lcy;&icy;&zcy;&icy;&rcy;&ucy;&jcy;&tcy;&iecy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&softcy;  <code>struct chunkfile</code>  &scy; &pcy;&ocy;&mcy;&ocy;&shchcy;&softcy;&yucy;  <code>init_chunkfile(NULL)</code> .</span></p> <p><span data-i18n="6f53a256a7116a1837cdd2ba98b3ab6bc68aeedf1fb257ec2ae1be7922c7200a/3b" data-source="After reading the header information from the beginning of the file, including the chunk count, call &lt;code&gt;read_table_of_contents()&lt;/code&gt; to populate the &lt;code&gt;struct chunkfile&lt;/code&gt; with the list of chunks, their offsets, and their sizes." onmousemove="i18n(this)">&Pcy;&ocy;&scy;&lcy;&iecy; &chcy;&tcy;&iecy;&ncy;&icy;&yacy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&icy; &zcy;&acy;&gcy;&ocy;&lcy;&ocy;&vcy;&kcy;&acy; &icy;&zcy; &ncy;&acy;&chcy;&acy;&lcy;&acy; &fcy;&acy;&jcy;&lcy;&acy;, &vcy;&kcy;&lcy;&yucy;&chcy;&acy;&yacy; &kcy;&ocy;&lcy;&icy;&chcy;&iecy;&scy;&tcy;&vcy;&ocy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;, &vcy;&ycy;&zcy;&ocy;&vcy;&icy;&tcy;&iecy;  <code>read_table_of_contents()</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &zcy;&acy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&softcy;  <code>struct chunkfile</code>  &scy;&pcy;&icy;&scy;&kcy;&ocy;&mcy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;, &icy;&khcy; &scy;&mcy;&iecy;&shchcy;&iecy;&ncy;&icy;&yacy;&mcy;&icy; &icy; &rcy;&acy;&zcy;&mcy;&iecy;&rcy;&acy;&mcy;&icy;.</span></p> <p><span data-i18n="4e4c4da068786d168c2bec46c5316abb30f10c9f9173771f6e735acab287d37d/a5" data-source="Extract the data information for each chunk using &lt;code&gt;pair_chunk()&lt;/code&gt; or &lt;code&gt;read_chunk()&lt;/code&gt;:" onmousemove="i18n(this)">&Icy;&zcy;&vcy;&lcy;&iecy;&kcy;&icy;&tcy;&iecy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&yucy; &ocy; &dcy;&acy;&ncy;&ncy;&ycy;&khcy; &dcy;&lcy;&yacy; &kcy;&acy;&zhcy;&dcy;&ocy;&gcy;&ocy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;, &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yacy;  <code>pair_chunk()</code>  &icy;&lcy;&icy;  <code>read_chunk()</code> :</span></p> <div> <ul> <li> <p><span data-i18n="8cd8fd401b2e7a7cc6524b61337da81d9dc8b4266a995fa6365113144875102e/8f" data-source="&lt;code&gt;pair_chunk()&lt;/code&gt; assigns a given pointer with the location inside the memory-mapped file corresponding to that chunk&amp;rsquo;s offset. If the chunk does not exist, then the pointer is not modified." onmousemove="i18n(this)"><code>pair_chunk()</code>  &ncy;&acy;&zcy;&ncy;&acy;&chcy;&acy;&iecy;&tcy; &zcy;&acy;&dcy;&acy;&ncy;&ncy;&ocy;&mcy;&ucy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&yucy; &mcy;&iecy;&scy;&tcy;&ocy;&pcy;&ocy;&lcy;&ocy;&zhcy;&iecy;&ncy;&icy;&iecy; &vcy;&ncy;&ucy;&tcy;&rcy;&icy; &ocy;&tcy;&ocy;&bcy;&rcy;&acy;&zhcy;&iecy;&ncy;&ncy;&ocy;&gcy;&ocy; &vcy; &pcy;&acy;&mcy;&yacy;&tcy;&icy; &fcy;&acy;&jcy;&lcy;&acy;, &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&ucy;&yucy;&shchcy;&iecy;&iecy; &scy;&mcy;&iecy;&shchcy;&iecy;&ncy;&icy;&yucy; &ecy;&tcy;&ocy;&gcy;&ocy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;. &IEcy;&scy;&lcy;&icy; &chcy;&acy;&ncy;&kcy; &ncy;&iecy; &scy;&ucy;&shchcy;&iecy;&scy;&tcy;&vcy;&ucy;&iecy;&tcy;, &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&softcy; &ncy;&iecy; &icy;&zcy;&mcy;&iecy;&ncy;&yacy;&iecy;&tcy;&scy;&yacy;.</span></p> </li> <li> <p><span data-i18n="312acaef98e3131646833664b62159cb5278d7fcd7b472a42abc352a2237a958/aa" data-source="&lt;code&gt;read_chunk()&lt;/code&gt; takes a &lt;code&gt;chunk_read_fn&lt;/code&gt; function pointer and calls it with the appropriate initial pointer and size information. The function is not called if the chunk does not exist. Use this method to read chunks if you need to perform immediate parsing or if you need to execute logic based on the size of the chunk." onmousemove="i18n(this)"><code>read_chunk()</code>  &pcy;&rcy;&icy;&ncy;&icy;&mcy;&acy;&iecy;&tcy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&softcy; &ncy;&acy; &fcy;&ucy;&ncy;&kcy;&tscy;&icy;&yucy;  <code>chunk_read_fn</code>  &icy; &vcy;&ycy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy; &iecy;&gcy;&ocy; &scy; &scy;&ocy;&ocy;&tcy;&vcy;&iecy;&tcy;&scy;&tcy;&vcy;&ucy;&yucy;&shchcy;&icy;&mcy; &ncy;&acy;&chcy;&acy;&lcy;&softcy;&ncy;&ycy;&mcy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&iecy;&mcy; &icy; &icy;&ncy;&fcy;&ocy;&rcy;&mcy;&acy;&tscy;&icy;&iecy;&jcy; &ocy; &rcy;&acy;&zcy;&mcy;&iecy;&rcy;&iecy;. &Fcy;&ucy;&ncy;&kcy;&tscy;&icy;&yacy; &ncy;&iecy; &vcy;&ycy;&zcy;&ycy;&vcy;&acy;&iecy;&tcy;&scy;&yacy;, &iecy;&scy;&lcy;&icy; &chcy;&acy;&ncy;&kcy; &ncy;&iecy; &scy;&ucy;&shchcy;&iecy;&scy;&tcy;&vcy;&ucy;&iecy;&tcy;. &Icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&jcy;&tcy;&iecy; &ecy;&tcy;&ocy;&tcy; &mcy;&iecy;&tcy;&ocy;&dcy; &dcy;&lcy;&yacy; &chcy;&tcy;&iecy;&ncy;&icy;&yacy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy;, &iecy;&scy;&lcy;&icy; &vcy;&acy;&mcy; &ncy;&ucy;&zhcy;&ncy;&ocy; &vcy;&ycy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&softcy; &ncy;&iecy;&mcy;&iecy;&dcy;&lcy;&iecy;&ncy;&ncy;&ycy;&jcy; &acy;&ncy;&acy;&lcy;&icy;&zcy; &icy;&lcy;&icy; &iecy;&scy;&lcy;&icy; &vcy;&acy;&mcy; &ncy;&ucy;&zhcy;&ncy;&ocy; &vcy;&ycy;&pcy;&ocy;&lcy;&ncy;&icy;&tcy;&softcy; &lcy;&ocy;&gcy;&icy;&kcy;&ucy; &vcy; &zcy;&acy;&vcy;&icy;&scy;&icy;&mcy;&ocy;&scy;&tcy;&icy; &ocy;&tcy; &rcy;&acy;&zcy;&mcy;&iecy;&rcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&acy;.</span></p> </li> </ul> </div> <p><span data-i18n="19473b9af96fea44721eda7c3f4091b614c56df0af6d8c07619764156bb4ad81/dc" data-source="After calling these methods, call &lt;code&gt;free_chunkfile()&lt;/code&gt; to clear the &lt;code&gt;struct chunkfile&lt;/code&gt; data. This will not close the memory-mapped region. Callers are expected to own that data for the timeframe the pointers into the region are needed." onmousemove="i18n(this)">&Pcy;&ocy;&scy;&lcy;&iecy; &vcy;&ycy;&zcy;&ocy;&vcy;&acy; &ecy;&tcy;&icy;&khcy; &mcy;&iecy;&tcy;&ocy;&dcy;&ocy;&vcy; &vcy;&ycy;&zcy;&ocy;&vcy;&icy;&tcy;&iecy;  <code>free_chunkfile()</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &ocy;&chcy;&icy;&scy;&tcy;&icy;&tcy;&softcy; &dcy;&acy;&ncy;&ncy;&ycy;&iecy;  <code>struct chunkfile</code> . &Ecy;&tcy;&ocy; &ncy;&iecy; &zcy;&acy;&kcy;&rcy;&ocy;&iecy;&tcy; &ocy;&bcy;&lcy;&acy;&scy;&tcy;&softcy;, &ocy;&tcy;&ocy;&bcy;&rcy;&acy;&zhcy;&iecy;&ncy;&ncy;&ucy;&yucy; &vcy; &pcy;&acy;&mcy;&yacy;&tcy;&icy;. &Ocy;&zhcy;&icy;&dcy;&acy;&iecy;&tcy;&scy;&yacy;, &chcy;&tcy;&ocy; &vcy;&ycy;&zcy;&ycy;&vcy;&acy;&yucy;&shchcy;&icy;&iecy; &ocy;&bcy;&hardcy;&iecy;&kcy;&tcy;&ycy; &bcy;&ucy;&dcy;&ucy;&tcy; &vcy;&lcy;&acy;&dcy;&iecy;&tcy;&softcy; &ecy;&tcy;&icy;&mcy;&icy; &dcy;&acy;&ncy;&ncy;&ycy;&mcy;&icy; &zcy;&acy; &pcy;&iecy;&rcy;&icy;&ocy;&dcy; &vcy;&rcy;&iecy;&mcy;&iecy;&ncy;&icy;, &kcy;&ocy;&gcy;&dcy;&acy; &ncy;&iecy;&ocy;&bcy;&khcy;&ocy;&dcy;&icy;&mcy;&ycy; &ucy;&kcy;&acy;&zcy;&acy;&tcy;&iecy;&lcy;&icy; &ncy;&acy; &rcy;&iecy;&gcy;&icy;&ocy;&ncy;.</span></p> </div> <h2 class="text-body-emphasis"  id="_examples"><span data-i18n="e68ee04dff59551b7d1ae07a2f8a00dc61d841628948da3d2781630706a05e92/38" data-source="Examples" onmousemove="i18n(this)">Examples</span></h2> <div> <p><span data-i18n="da1b106bd3a7aa1af192a3fa614758403a7e90bbabd51d9642be4a0c6ef70ae0/51" data-source="These file formats use the chunk-format API, and can be used as examples for future formats:" onmousemove="i18n(this)">&Ecy;&tcy;&icy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ycy; &fcy;&acy;&jcy;&lcy;&ocy;&vcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&yucy;&tcy; API &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &icy; &mcy;&ocy;&gcy;&ucy;&tcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ocy;&vcy;&acy;&tcy;&softcy;&scy;&yacy; &vcy; &kcy;&acy;&chcy;&iecy;&scy;&tcy;&vcy;&iecy; &pcy;&rcy;&icy;&mcy;&iecy;&rcy;&ocy;&vcy; &dcy;&lcy;&yacy; &bcy;&ucy;&dcy;&ucy;&shchcy;&icy;&khcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&ocy;&vcy;:</span></p> <div> <ul> <li> <p><span data-i18n="2e35b05bd54bf04ba9358c0fd13d6b3d4db2333c991f00ee713e5f21fe01e1ed/35" data-source="&lt;strong&gt;commit-graph:&lt;/strong&gt; see &lt;code&gt;write_commit_graph_file()&lt;/code&gt; and &lt;code&gt;parse_commit_graph()&lt;/code&gt; in &lt;code&gt;commit-graph.c&lt;/code&gt; for how the chunk-format API is used to write and parse the commit-graph file format documented in the commit-graph file format in &lt;a href=&quot;gitformat-commit-graph&quot;&gt;gitformat-commit-graph[5]&lt;/a&gt;." onmousemove="i18n(this)">commit-graph: &scy;&mcy;.  <code>write_commit_graph_file()</code>  &icy;  <code>parse_commit_graph()</code>  &vcy;  <code>commit-graph.c</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &ucy;&zcy;&ncy;&acy;&tcy;&softcy;, &kcy;&acy;&kcy; API &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &dcy;&lcy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy; &acy;&ncy;&acy;&lcy;&icy;&zcy;&acy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&acy;&jcy;&lcy;&acy; &gcy;&rcy;&acy;&fcy;&icy;&kcy;&acy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy;, &dcy;&ocy;&kcy;&ucy;&mcy;&iecy;&ncy;&tcy;&icy;&rcy;&ocy;&vcy;&acy;&ncy;&ncy;&ocy;&gcy;&ocy; &vcy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&iecy; &fcy;&acy;&jcy;&lcy;&acy; &gcy;&rcy;&acy;&fcy;&icy;&kcy;&acy; &fcy;&icy;&kcy;&scy;&acy;&tscy;&icy;&icy; &vcy;  <a href="gitformat-commit-graph.html">gitformat-commit-graph[5]</a> .</span></p> </li> <li> <p><span data-i18n="41cf257d0718ee2815fa232effef1d251b339d9bd45054e38fd7224d97c6ac2e/45" data-source="&lt;strong&gt;multi-pack-index:&lt;/strong&gt; see &lt;code&gt;write_midx_internal()&lt;/code&gt; and &lt;code&gt;load_multi_pack_index()&lt;/code&gt; in &lt;code&gt;midx.c&lt;/code&gt; for how the chunk-format API is used to write and parse the multi-pack-index file format documented in the multi-pack-index file format section of &lt;a href=&quot;gitformat-pack&quot;&gt;gitformat-pack[5]&lt;/a&gt;." onmousemove="i18n(this)">multi-pack-index: &scy;&mcy;.  <code>write_midx_internal()</code>  &icy;  <code>load_multi_pack_index()</code>  &vcy;  <code>midx.c</code> , &chcy;&tcy;&ocy;&bcy;&ycy; &ucy;&zcy;&ncy;&acy;&tcy;&softcy;, &kcy;&acy;&kcy; API &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&rcy;&acy;&gcy;&mcy;&iecy;&ncy;&tcy;&ocy;&vcy; &icy;&scy;&pcy;&ocy;&lcy;&softcy;&zcy;&ucy;&iecy;&tcy;&scy;&yacy; &dcy;&lcy;&yacy; &zcy;&acy;&pcy;&icy;&scy;&icy; &icy; &acy;&ncy;&acy;&lcy;&icy;&zcy;&acy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&acy;&jcy;&lcy;&acy; multi-pack-index, &ocy;&pcy;&icy;&scy;&acy;&ncy;&ncy;&ocy;&gcy;&ocy; &vcy; &rcy;&acy;&zcy;&dcy;&iecy;&lcy;&iecy; &fcy;&ocy;&rcy;&mcy;&acy;&tcy;&acy; &fcy;&acy;&jcy;&lcy;&acy; multi-pack-index &vcy;  <a href="gitformat-pack.html">gitformat-pack[5]</a> .</span></p> </li> </ul> </div> </div><address>
<p>
    &copy; 2012&ndash;2024 Scott Chacon and others<br/>Licensed under the MIT License.<br/>
<a href="https://git-scm.com/docs/gitformat-chunk">https://git-scm.com/docs/gitformat-chunk</a>
</p>
</address>                </article>
            </main>

            <br>
            <br>
            <hr>

                               <ins class="adsbygoogle"
        style="display:block"
        data-ad-format="autorelaxed"
        data-ad-client="ca-pub-6424571640879890"
        data-ad-slot="7867651344"></ins>
   <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
   </script>            
        </div>

        <!-- -->

        <div class="col-md-3">
            <br>
            <form action="-index-.html">
                <div class="input-group">
                    <input class="form-control" type="search" name="q" placeholder="Search for Git" required>
                    <button class="btn btn-primary" type="submit">
                        <i class="bi bi-search"></i>
                    </button>
                </div>
            </form>
            <br>

                            <div class="list-group list-group-flush">
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitformat-commit-graph.html">
                            gitformat commit-graph                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitformat-index.html">
                            gitformat index                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitformat-pack.html">
                            gitformat pack                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitformat-signature.html">
                            gitformat signature                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitglossary.html">
                            gitglossary                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="githooks.html">
                            githooks                        </a>
                                            <a class="list-group-item list-group-item-action text-primary-emphasis px-2 text-truncate" href="gitignore.html">
                            gitignore                        </a>
                                    </div>
            
            <br>
            <div class="my-3">
                <ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-6424571640879890"
     data-ad-slot="3954319254"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>            </div>
            <br>

            
            
        </div>
    </div>
</div>    <!--/sse-->

    <footer>
        <br>
        <div class="container">
            <div class="row">
                <div class="col">
                    <hr>
                    <div class="row">
                        <div class="col-md-10">
                            <ul class="nav">
                                <li class="nav-item">
                                    <a class="nav-link ps-0" href="https://runebook.dev/">Help us Improve Translation</a>
                                </li>
                                                            </ul>
                        </div>
                        <div class="col-md-2 text-end">
                            <a href="gitformat-chunk.html#" class="fs-5" aria-label="Top">
                                <i class="bi bi-arrow-up-square-fill"></i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <br>
    </footer>
    <script src="../../../runebook.js"></script>
</body>

</html>